﻿using System;
using System.Collections.Generic;

namespace mvcForum.Core.Helpers {

	public static class PathHelper {
		private const String alpha = "abcdefghijklmnopqrstuvwxyz";

		public static String[] GetPath(Int32 levels, Int64 seed) {
			List<String> path = new List<String>();
			Int64 value = 1;
			for (Int32 index = 0; index < levels - 1; index++) {
				value = value * alpha.Length;
			}
			for (Int32 index = 0; index <= levels - 1; index++) {
				Int32 levelValue = (Int32)(seed / value);
				seed = seed % value;
				value = value / alpha.Length;
				path.Add(alpha[levelValue].ToString());
			}

			return path.ToArray();
		}
	}
}